import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { AnswerService } from './answer.service';
import { Answer } from './schemas/answer.schema';
import { Public } from 'src/auth/decorators/public.decorator';

@Controller('answer')
export class AnswerController {
  constructor(private readonly answerService: AnswerService) {}

  // 创建答卷
  @Public()
  @Post()
  async createOne(@Body() answerInfo: Answer) {
    return await this.answerService.create(answerInfo);
  }

  // 获取答卷列表
  @Get(':id')
  async getAll(@Param('id') id: string) {
    return await this.answerService.getAll(id);
  }
}
